import request from "@/router/axios";

import { get } from "lodash";

export function getEquipments(params) {
  return request({
    url: "/admin/device/list",
    method: "get",
    params,
  });
}

export function getEquipmentOptions(params) {
  return request({
    url: "/admin/device/list",
    method: "get",
    params,
  });
}

export function updateEquipment(data) {
  return request({
    url: "/admin/device/edit",
    method: "post",
    data,
  });
}

export function putEquipmentsBinding(data) {
  return request({
    url: "/admin/device/bind",
    method: "post",
    data,
  });
}

export function getDeviceLogInfo(params) {
  return request({
    url: "/admin/device/logDetail",
    method: "get",
    params,
  });
}

export function getDeviceInfo(params) {
  return request({
    url: "/admin/device/detail",
    method: "get",
    params,
  });
}

export function getDeviceThresholdList(params) {
  return request({
    url: "/admin/getDeviceThresholdList",
    method: "get",
    params,
  });
}

export function addDeviceThreshold(data) {
  return request({
    url: "/admin/addDeviceThreshold",
    method: "post",
    data,
  });
}

export function getDeviceBasic(params = {}) {
  return request({
    url: "/api/third/index",
    params,
  });
}

export function getDeviceRadar(id, type = 0) {
  return request({
    url: "/rhws/device/radar",
    params: {
      device_id: id,
      type,
    },
  });
}

export function getDeviceMonitoring(id, indexGroupId, type, threshold_id) {
  return request({
    url: "/rhws/device/monitoring",
    params: {
      device_id: id,
      // device_gear_box_id: id,
      type,
      threshold_id: threshold_id,
      indexGroupId: indexGroupId,
    },
  });
}

export function getDeviceLineData(params = {}) {
  return request({
    url: "/rhws/device/brokenLine",
    params,
  });
}

export function getDeviceBrokenLineInfo(params) {
  return request({
    url: "/rhws/device/brokenLineInfo",
    method: "get",
    params,
  });
}

// 获取设备详情
export function getDeviceDetail(params) {
  return request({
    url: "/rhws/device/detail",
    method: "get",
    params,
  });
}

// 设备维保，订单记录列表
export function getOrderList(params) {
  return request({
    url: "/rhws/service/order/list",
    method: "get",
    params,
  });
}

// 设备维保，订单详情
export function getOrderDetail(params) {
  return request({
    url: "/rhws/service/order/detail",
    method: "get",
    params,
  });
}

// 修改维保、订单信息
export function UpdataOrderInfo(data) {
  return request({
    url: "/rhws/service/edit",
    method: "post",
    data,
  });
}

// 删除维保、订单信息
export function DeleteOrder(data) {
  return request({
    url: "/rhws/service/delete",
    method: "post",
    data,
  });
}

export function getDeviceFollow(id) {
  return request({
    url: "/rhws/device/follow/list",
    params: {
      device_id: id,
    },
  });
}
export function getAddFollow(data) {
  return request({
    url: "rhws/device/follow/add",
    method: "post",
    data,
  });
}
